#include "Image.h"

Image::Image(const std::string& file)
{
    SDL_Surface* tmp = IMG_Load(file.data());
    mSurface = SDL_DisplayFormat(tmp);
    SDL_FreeSurface(tmp);
}
Image::Image(SDL_Surface* file)
{
    //SDL_Surface* tmp = IMG_Load(file.data());
    mSurface = SDL_DisplayFormat(file);
    SDL_FreeSurface(file);
}
void Image::UpdateSurface(SDL_Surface* update)
{
    mSurface = update;
}
void Image::SetTransparency(int r, int g, int b)
{
    SDL_SetColorKey(mSurface, SDL_SRCCOLORKEY | SDL_RLEACCEL ,
    SDL_MapRGB(mSurface->format,r,g,b));
}
Image::~Image()
{
    SDL_FreeSurface(mSurface);
    //dtor
}
